package com.faithbj.printer.service;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Map;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.impl.client.CloseableHttpClient;

public interface RemoteInteractive {
	
	/**
	 * 从数据服务器获取指定url的HTML页面源码（get方法）
	 * 
	 * @param url 资源的路径
	 * @param httpClient
	 * @return
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	public String getResource(String url, final CloseableHttpClient httpClient)
			throws ClientProtocolException, IOException;

	/**
	 * 
	 * @param url 请求的URL路径，包括get参数
	 * @param params 要封装的post参数
	 * @param httpClient
	 * @return
	 * @throws UnsupportedEncodingException
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	public String postResource(String url, final Map<String,String> params, final CloseableHttpClient httpClient) throws UnsupportedEncodingException, ClientProtocolException, IOException;
	
	/**
	 * 从数据服务器获取指定url的HTML页面源码（get方法）
	 * 
	 * @param url 资源的路径
	 * @return
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	public String getResource(String url) throws ClientProtocolException, IOException;
	
}
